package com.PAT.UnSatisfying;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/01/26/16:47
 * @Description: 若正整数 N 可以整除它的 4 个不同正因数之和，则称这样的正整数为“大美数”。本题就要求你判断任一给定的正整数是否是“大美数”
 * @Target: 差1
 */
public class 大美数 {
    // 18 29 40 ---正整数 N 可以整除它的 4 个不同正因数之和
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int len = in.nextInt();
        for (int i = 0; i < len; i++) {
            outPrint(in.nextInt());
        }

    }

    public static void outPrint(int x){
        boolean flag = false;

        ArrayList<Integer> positiveFactor = getPositiveFactor(x);

        Object[] objects = positiveFactor.toArray();
        Integer[] integers = new Integer[objects.length];
        int index = 0;
        for (Object object : objects) {
            integers[index++]=(Integer) object;
        }

        if (objects.length<4){
            flag = false;
        }else {
            for (int i = 0; i < integers.length-3; i++) {
                for (int j = i+1; j < integers.length-2; j++) {
                    for (int k = j+1; k < integers.length-1; k++) {
                        for (int l = k+1; l < integers.length; l++) {
                            int sum = integers[i]+integers[j]+integers[k]+integers[l];
                            if (sum%x==0){
                                flag = true;
                            }
                        }
                    }

                }
            }
        }

        if (flag==true){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }

    // 先解析出每个数的正因数
    public static ArrayList<Integer> getPositiveFactor(int X){
        ArrayList<Integer> list = new ArrayList();
        if (X==0){
            list.add(0);
        }


        for (int i = 1; i <= Math.sqrt(X); i++) {
            if (X%i==0){
                list.add(i);
                list.add(X/i);
            }
        }

       return list;

    }
}
